package com.itheima.controller;

import com.itheima.Service.ProductService;
import com.itheima.pojo.Product;
import com.itheima.pojo.Result;
import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/api/shouye/product")
public class ShouYeController {

    @Autowired
    private ProductService productService;

    /*
    获取首页热门商品
     */
    @GetMapping("/for")
    public Result select4(){
        List<Product> product4 =  productService.select4();
        return Result.success(product4);
    }
    //获取首页新品列表
    @GetMapping("new")
    public Result selectNew(){
        List<Product> productNew =  productService.selectNew();
        return Result.success(productNew);
    }
}
